<?php
    /**
     * This is used to pop-up a view of a portfolio page.
     *
     */

    require_once("../../../includes.php");
    require_once("../view/page.php");
    require_once("../model/user.php");

    $url = url;


    // Load Data from POST
    $page_ident = intval(required_param( 'page_ident' ));
    $page = folio_page::SelectWherePageIdent( $page_ident );
    if ( !$page )
        trigger_error('Invalid page '. $user_ident . ' passed', E_USER_ERROR);

    if( !$page->Permission('select')) {
        trigger_error('You do not have permission to view this page.', E_USER_ERROR);
    }

    // Render page
    $html = new folio_PageBodyView( $page );
    $html->Load( new folio_PageAttachmentView($page));

	// Add log entry to show that this page has been viewed.
	folio_history_pagelog($page, 'popup_viewed' );

	
    echo '<html><body>';
    echo $html->toString();
    echo '</body></html>';
?>
